Xbasic

JDATE Function

Syntax

Julian_Date as N = JDATE(D date)

Arguments

date

Optional. Default = DATE(). A variable containing a date value or a character string containing a legitimate representation of a date value ( ISDATE ( Date_Value ) = .T.).

Description

Returns a number which is the Julian equivalent to a specified date.

Discussion

JDATE() returns the integer Julian date equivalent of Date_Value. The Julian date is an integer value measured in days from a special starting date. You can use the resulting value with other numeric values to do special computations on dates. For example, to compute the "day of the year", use this expression: JDATE( Date_Value ) - JDATE(CTOD("1/1/" + YEAR( Date_Value ))) + 1.

Example

?jdate({1/5/95})
= 2449723
?jdate({3/10/95})
= 449787
' computes the "day of the year" assuming today is 7/12/99
? jdate() - jdate({1/1/99})
= 192

The following expression returns the day of the year.

? jdate( date() )-jdate( ctod( "01/01/"+cyear( date() ) ) ) + 1
= 327

See Also